package com.homestay.common;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@Data
@Getter
@Setter
public class Result<T> {
    public Integer code;
    public String msg;
    public T data;
    public static <T> Result<T> success(T data){
        Result result=new Result();
        result.setCode(200);
        result.setData(data);
        return result;
    }
    public static <T> Result<T> error(Integer code,String msg){
        Result result=new Result();
        result.setMsg(msg);
        result.setCode(code);
        return result;
    }
    public static <T> Result<T> success(){
        Result result=new Result();
        result.setCode(200);
        result.setData(null);
        return result;
    }


}
